1. Field of the Invention:
The present invention relates in general to an improved data retrieval system and in particular to a method and system for retrieving data from a relational database outside of an object-oriented environment. Still more particularly, the present invention relates to a method and system for data retrieval without exiting the object-oriented environment.
2. Description of the Prior Art:
Object-oriented languages confer the benefits of extendibility and reusable code, but in an object-oriented environment, situations exist in which accessing data in a relational database outside of the environment is desirable. At this point in time, object-oriented databases are being researched and developed in which an existing relational database is redesigned and rewritten as an object-oriented database, but large amounts of data in the modern electronic office environment are contained in already existing relational databases. In such situations, a need may exist to access data in these relational databases without exiting the object-oriented environment. Unfortunately, at the present time no system exists in a true object-oriented environment to retrieve data from a relational database without exiting the environment. Presently, individuals working in an object-oriented environment must exit the environment to access data using traditional relational database access techniques.
An object in an object-oriented environment is consists of related pieces of code and data. An object has a library of methods which are essentially unique to an object giving an object its specific behaviors. The class of an object defines a grouping based on one or more properties, and an instance is a single item in a class. For example, a class of an object could be considered as analogous to professions, i.e. lawyers doctors, engineers, and programmers, with an instance of an object being analogous to a particular individual in a class.
A class defines methods for constructing new instances and also instance methods which define how an instance behaves and reacts to incoming messages. The instance variables define the particular features of an instance of an object such as an individual's salary. These instance variables may be defined or may be empty awaiting definition. An instance's data structure is described by its collection of instance variables. Pointers are used to point to a structure in object form.
Smalltalk-80 uses a Model-View-Controller scheme for structuring an application. Model objects derive and manipulate data, while view objects are responsible for screen presentation and user interaction. The view objects govern the application flow and send messages to model objects to retrieve or modify data. The controller manages input and output signals from external devices.
A basic incompatibility exists between object-oriented environments and relational databases. Object-oriented environments are rich with pointers pointing to data structures, while relational databases are flat in organization. The relationships between data in object-oriented environments are therefore built in to the structure of data objects. Since relational databases use a flat, table oriented approach to data storage, these relationships are not made explicit as part of the data storage technique. This makes it difficult for data stored in a relational database to be translated into an object-oriented format.
For example, the Smalltalk V/PM language, a product of Digitalk, Inc., does not support direct access to external relational databases. It does, however, allow OS/2 Dynamic Link Library ("DLL") routines to be invoked and parameters passed to them. Unfortunately, only a single value may be returned from the routine, generally a half word integer or a pointer. Since a return must point to a structure in object form, this restriction makes it difficult to return multiple column values for a row and assign them directly into instance variables.
C++ allows retrieval of data from a relational database through direct access to a C program, but is an extension to C for object-oriented programming. It adds the structure "class" to C but primarily centers on improvements to the C language. C++ is a hybrid language and not a true object-oriented language. In C++, the concept of environment is not the same as in Smalltalk where every message uses dynamic binding.
Therefore, it should be apparent that a method and system is needed to access data in a relational database without the user having to exit the object-oriented environment would be desirable.